package com.kingboy.cloud.swagger2;
/**
 * @author kingboy
 * @create 2020-08-04 16:21
 */

import springfox.documentation.spring.web.paths.RelativePathProvider;

import javax.servlet.ServletContext;

/**
 *@Description 相对路径重写
 *@auther 郭金宝
 *@create 2020-08-04 16:21
 */


public class ExtRelativePathProvider extends RelativePathProvider {
    private String basePath;

    /**
     * @param servletContext
     * @param basePath
     */
    public ExtRelativePathProvider(ServletContext servletContext, String basePath) {
        super(servletContext);
        this.basePath = basePath;
    }

    @Override
    public String getApplicationBasePath() {
        String applicationPath = super.applicationPath();
        if (ROOT.equals(applicationPath)) {
            applicationPath = "";
        }
        return basePath + applicationPath;
    }
}

